const multer = require('multer');
const path = require('path')
//简单写法
// const upload = multer({ dest: 'uploads/' })
//完整写法
const storage = multer.diskStorage({
    destination: function (req, file, cb) {
        cb(null, path.join(__dirname, '../public/images'));
    },
    //配置文件名
    filename: function (req, file, cb) {
        let time = Date.now();
        cb(null, Date.now() + "-" + file.originalname);
    }
})
const upload = multer({ storage: storage });
module.exports = upload;
